<template>
   <div v-if="modelValue" class="box">
        <div class="header"><button @click="close">关闭</button></div>
        <div>我是V-model子组件 dialog</div>
        <div>内容：<input @input="change" type="text" :value="textVal"></div>
    
   </div>
</template>

<script setup lang='ts'>
import {ref ,reactive} from 'vue'
const props = defineProps<{
    modelValue:boolean,
    textVal:string,
    textValModifiers?:{
        isBt:boolean
    }
}>()

const emit = defineEmits(['update:modelValue','update:textVal'])
const close = ()=>{
    emit('update:modelValue',false)
}
const change = (e:Event)=>{
    const target = e.target as HTMLInputElement
    console.log(target.value);

    emit('update:textVal',props?.textValModifiers?.isBt ? target.value + 'bt':target.value)
}
</script>

<style lang="less" scoped>
 .box{
    height: 100px;
    width: 400px;
    border: 2px solid #ccc;
    padding: 10px;

    .header{
        display: flex;
        justify-content: flex-end;
    }
 }
</style>